<?php
/**
 * Created by PhpStorm.
 * User: Ruzi
 * Date: 2015/12/15
 * Time: 12:20
 */

header("Content-type: application/json; charset=utf-8");
header("Access-Control-Allow-Origin: *");
//根据算出来的数据，生成json数据
if(isset($_POST["data"])){

    $a=$_POST["data"];



        $file1="data_small_api.json";
        $file2="final_data.php";

    //$b=json_decode($a,true);

    $myfile = fopen($file1, "w") or die("Unable to open file!");
    $myfile1 = fopen($file2, "w") or die("Unable to open file!");

    file_put_contents($file1,$a);
    file_put_contents($file2,$a);

    $a = array("success" =>true );

    echo json_encode($a);



}